package com.bt.dmdb.model;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "ODS_ORDER_ITEMS")
@SuppressWarnings("serial")
public class OrderItem implements java.io.Serializable {

    private BigDecimal id;
    private Order order;
    private Integer orderResponseSequence;
    private String orderStatus;
    private String orderSubStatus;
    private Date orderCompleteDate;
    private String orderItemStatus;
    private String orderItemSubStatus;
    private Date lastCrdChange;
    private Integer noOfCrdChanges;
    private Long serviceId;
    private Long supplierErrorCode;
    private String supplierErrorText;
    private Set<OrderKsu> orderKsus = new HashSet<OrderKsu>(0);

    public OrderItem() {
    }

    public OrderItem(BigDecimal id, Order order) {
        this.id = id;
        this.order = order;
    }

    public OrderItem(BigDecimal id, Order order, Integer orderResponseSequence, String orderStatus, String orderSubStatus, Date orderCompleteDate, String orderItemStatus, String orderItemSubStatus, Date lastCrdChange, Integer noOfCrdChanges, Long serviceId, Long supplierErrorCode, String supplierErrorText, Set<OrderKsu> orderKsus) {
        this.id = id;
        this.order = order;
        this.orderResponseSequence = orderResponseSequence;
        this.orderStatus = orderStatus;
        this.orderSubStatus = orderSubStatus;
        this.orderCompleteDate = orderCompleteDate;
        this.orderItemStatus = orderItemStatus;
        this.orderItemSubStatus = orderItemSubStatus;
        this.lastCrdChange = lastCrdChange;
        this.noOfCrdChanges = noOfCrdChanges;
        this.serviceId = serviceId;
        this.supplierErrorCode = supplierErrorCode;
        this.supplierErrorText = supplierErrorText;
        this.orderKsus = orderKsus;
    }

    @Id
    @Column(name = "ID", unique = true, nullable = false, scale = 0)
    public BigDecimal getId() {
        return this.id;
    }

    public void setId(BigDecimal id) {
        this.id = id;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ORDER_ID", nullable = false)
    public Order getOrder() {
        return this.order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    @Column(name = "ORDER_RESPONSE_SEQUENCE", precision = 5, scale = 0)
    public Integer getOrderResponseSequence() {
        return this.orderResponseSequence;
    }

    public void setOrderResponseSequence(Integer orderResponseSequence) {
        this.orderResponseSequence = orderResponseSequence;
    }

    @Column(name = "ORDER_STATUS", length = 50)
    public String getOrderStatus() {
        return this.orderStatus;
    }

    public void setOrderStatus(String orderStatus) {
        this.orderStatus = orderStatus;
    }

    @Column(name = "ORDER_SUB_STATUS", length = 50)
    public String getOrderSubStatus() {
        return this.orderSubStatus;
    }

    public void setOrderSubStatus(String orderSubStatus) {
        this.orderSubStatus = orderSubStatus;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "ORDER_COMPLETE_DATE", length = 7)
    public Date getOrderCompleteDate() {
        return this.orderCompleteDate;
    }

    public void setOrderCompleteDate(Date orderCompleteDate) {
        this.orderCompleteDate = orderCompleteDate;
    }

    @Column(name = "ORDER_ITEM_STATUS", length = 50)
    public String getOrderItemStatus() {
        return this.orderItemStatus;
    }

    public void setOrderItemStatus(String orderItemStatus) {
        this.orderItemStatus = orderItemStatus;
    }

    @Column(name = "ORDER_ITEM_SUB_STATUS", length = 50)
    public String getOrderItemSubStatus() {
        return this.orderItemSubStatus;
    }

    public void setOrderItemSubStatus(String orderItemSubStatus) {
        this.orderItemSubStatus = orderItemSubStatus;
    }

    @Temporal(TemporalType.DATE)
    @Column(name = "LAST_CRD_CHANGE", length = 7)
    public Date getLastCrdChange() {
        return this.lastCrdChange;
    }

    public void setLastCrdChange(Date lastCrdChange) {
        this.lastCrdChange = lastCrdChange;
    }

    @Column(name = "NO_OF_CRD_CHANGES", precision = 5, scale = 0)
    public Integer getNoOfCrdChanges() {
        return this.noOfCrdChanges;
    }

    public void setNoOfCrdChanges(Integer noOfCrdChanges) {
        this.noOfCrdChanges = noOfCrdChanges;
    }

    @Column(name = "SERVICE_ID", precision = 10, scale = 0)
    public Long getServiceId() {
        return this.serviceId;
    }

    public void setServiceId(Long serviceId) {
        this.serviceId = serviceId;
    }

    @Column(name = "SUPPLIER_ERROR_CODE", precision = 10, scale = 0)
    public Long getSupplierErrorCode() {
        return this.supplierErrorCode;
    }

    public void setSupplierErrorCode(Long supplierErrorCode) {
        this.supplierErrorCode = supplierErrorCode;
    }

    @Column(name = "SUPPLIER_ERROR_TEXT", length = 500)
    public String getSupplierErrorText() {
        return this.supplierErrorText;
    }

    public void setSupplierErrorText(String supplierErrorText) {
        this.supplierErrorText = supplierErrorText;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "orderItem")
    public Set<OrderKsu> getOrderKsus() {
        return this.orderKsus;
    }

    public void setOrderKsus(Set<OrderKsu> orderKsus) {
        this.orderKsus = orderKsus;
    }
}
